* {
    margin: 0;
    padding: 0;
}
div {
    background: pink;
}
.clearfix:before,
.clearfix:after { 
    content:".";
    display:table;  /* 这句话可以触发BFC，BFC可以清除浮动,BFC在后面 */
    opacity: 0;
}
.clearfix:after {
   clear:both;
}